<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- <%@include file="../../common/taglib/taglib.jsp"%> --%>
<form id="pagerForm" method="post" action="${baseURL }/trade/listPaymentOrder">
	<%@include file="../common/pageParameter.jsp"%>
</form>
<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="${baseURL }/trade/listPaymentOrder" method="post">
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td colspan="2">
						商户编号：
						<input type="text" name="merchantNo" value="${paymentOrderQueryParam.merchantNo}" />
						&nbsp;&nbsp;
						商户订单号：
						<input type="text" name="merchantOrderNo" value="${paymentOrderQueryParam.merchantOrderNo}" />
						<%-- &nbsp;&nbsp;
						商户名称：
						<input type="text" name="merchantName" value="${paymentOrderQueryParam.merchantName}" /> --%>
					</td>
				</tr>
				
				<tr>
					<td colspan="2">
						下单时间：
						<input type="text" size="16" id="orderDateBegin" name="orderDateBegin" value="${paymentOrderQueryParam.orderDateBegin}" class="date textInput readonly" datefmt="yyyy-MM-dd HH:mm:ss" readonly="true">
						到&nbsp;<input type="text" size="16" id="orderDateEnd" name="orderDateEnd" value="${paymentOrderQueryParam.orderDateEnd}" class="date textInput readonly" datefmt="yyyy-MM-dd HH:mm:ss" readonly="true">
						&nbsp;
						[&nbsp;<a href="javascript:void(0);" onclick="selectOrderDate('today');" style="color:blue;">今天</a>&nbsp;]
						[&nbsp;<a href="javascript:void(0);" onclick="selectOrderDate('yesterday');" style="color:blue;">昨天</a>&nbsp;]
						[&nbsp;<a href="javascript:void(0);" onclick="selectOrderDate('clean');" style="color:blue;">清除</a>&nbsp;]
					</td>
				</tr>
				<tr>
					<td>
						订单状态： 
						<select name="status">
							<option value="">请选择</option>
							<c:forEach items="${statusEnums}" var="statusVar">
								<option value="${statusVar.key}" <c:if test="${paymentOrderQueryParam.status == statusVar.key}"> selected="selected"</c:if>>${statusVar.value.desc}</option>
							</c:forEach>
						</select>
						&nbsp;&nbsp;
						支付方式： 
						<select name="payWayName">
							<option value="">请选择</option>
							<c:forEach items="${payWayNameEnums}" var="payWayNameVar">
								<option value="${payWayNameVar.value.desc}" <c:if test="${paymentOrderQueryParam.payWayName == payWayNameVar.value.desc}"> selected="selected"</c:if>>${payWayNameVar.value.desc}</option>
							</c:forEach>
						</select>
						&nbsp;&nbsp;
						支付类型： 
						<select name="payTypeName">
							<option value="">请选择</option>
							<c:forEach items="${payTypeNameEnums}" var="payTypeNameVar">
								<option value="${payTypeNameVar.value.desc}" <c:if test="${paymentOrderQueryParam.payTypeName == payTypeNameVar.value.desc}"> selected="selected"</c:if>>${payTypeNameVar.value.desc}</option>
							</c:forEach>
						</select>
						<%-- &nbsp;&nbsp;
						资金流入类型： 
						<select name="fundIntoType">
							<option value="">请选择</option>
							<c:forEach items="${fundIntoTypeEnums}" var="fundIntoTypeVar">
								<option value="${fundIntoTypeVar.key}" <c:if test="${paymentOrderQueryParam.fundIntoType == fundIntoTypeVar.key}"> selected="selected"</c:if>>${fundIntoTypeVar.value.desc}</option>
							</c:forEach>
						</select> --%>
					</td>
					<td>
						<div class="buttonActive">
							<div class="buttonContent">
								<button title="查询" type="submit">查&nbsp;询</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<table class="table" width="100%" layoutH="135">
		<thead>
			<tr>
				<th width="36">序号</th>
				<!-- <th width="130">下单日期</th> -->
				<th width="130">下单时间</th>
				<th width="180">商户编号</th>
				<th width="180">商户订单号</th>
				<th width="70">订单金额</th>
				<th width="60">状态</th>
				<th width="60">支付方式</th>
				<th width="120">支付类型</th>
				<th>商户名称</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="item" items="${pageBean.recordList}" varStatus="s">
				<tr>
					<td>${s.index + 1}</td>
					<%-- <td>
						<fmt:formatDate value="${item.orderDate}" pattern="yyyy-MM-dd" />
					</td> --%>
					<td>
						<fmt:formatDate value="${item.orderTime}" pattern="yyyy-MM-dd HH:mm:ss" />
					</td>
					<td>${item.merchantNo}</td>
					<td>${item.merchantOrderNo}</td>
					<td>
						<fmt:parseNumber type="number" pattern="#,#00.0#">${item.orderAmount}</fmt:parseNumber>
					</td>
					<td>
						<c:forEach items="${statusEnums}" var="statusVar">
							<c:if test="${item.status == statusVar.key}">
								<c:if test="${item.status == 'SUCCESS' || item.status == 'FINISH'}">
									<font color="blue">${statusVar.value.desc}</font>
								</c:if>
								<c:if test="${item.status != 'SUCCESS' && item.status != 'FINISH'}">
									<font color="gray">${statusVar.value.desc}</font>
								</c:if>
							</c:if>
						</c:forEach>
					</td>
					<td>${item.payWayName}</td>
					<td>${item.payTypeName}</td>
					<td>${item.merchantName}</td>
				</tr>
			</c:forEach>
			<c:if test="${pageBean.totalCount==0}">
				<tr>
					<td>暂无数据</td>
				</tr>
			</c:if>
		</tbody>
	</table>
	<%@include file="../common/pageBar.jsp"%>
</div>
<script type="text/javascript">
//获取订单日期
function selectOrderDate(param){
	if(param == null || param == ""){
		return;
	}
	if(param == "today"){
		// 获取当天的日期
		var clock = getDateStr(0);
        $("#orderDateBegin").val(clock + " 00:00:00");
        clock = getDateStr(0);
        $("#orderDateEnd").val(clock + " 23:59:59");
	}else if (param == "yesterday"){
		// 昨天
		var clock = getDateStr(-1);
        $("#orderDateBegin").val(clock + " 00:00:00");
        clock = getDateStr(-1);
        $("#orderDateEnd").val(clock + " 23:59:59");
	}else if (param == "clean"){
		// 清空时间
        $("#orderDateBegin").val("");
        $("#orderDateEnd").val("");
	}
}

// 格式化日期
function getDateStr(AddDayCount) {
    var dd = new Date();
    dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
    var y = dd.getFullYear();
    var m = dd.getMonth()+1;//获取当前月份的日期
    var d = dd.getDate();
    if(m < 10){
    	m = "0" + m;
    }
    if(d < 10){
    	d = "0" + d;
    }
    return y+"-"+m+"-"+d;
}
</script>